{extend name="./template/default/m/pub/base.html" /}
{block name="seo"}
<?php $book_name=remove_tag($book->book_name); ?>
<title>{$book.book_name|remove_tag|default=''} - {$book_name|remove_tag|default=''}漫画免费 - {$book_name}漫画最新章节免费在线阅读-{$site_name}</title>
<meta name="description" content="{$book.book_name|remove_tag|default=''}漫画又名{$book.nick_name}漫画,类型为{$book.tags}的高人气免费漫画，漫画简介：{$book.summary}">

<meta property="og:title" content="{$book.book_name|remove_tag|default=''} - {$book_name}漫画免费 - {$book_name}漫画最新章节免费在线阅读-{$site_name}"/>
<meta property="og:description" content= "{$book.book_name|remove_tag|default=''}漫画又名{$book.nick_name}漫画,类型为{$book.tags}的高人气免费漫画，漫画简介：{$book.summary}" />
<meta property="og:updated_time" content="{$book.last_time|date='Y-m-dTH:i:s'}">
<meta property="og:image" content="{$book.cover_url|get_img_url|default=''}">{/block}
{block name="css"}
<link rel="stylesheet" href="/static/css/jquery-ui-1.7.3.custom.css">
<link href="https://lib.baomitu.com/Swiper/4.5.0/css/swiper.min.css" rel="stylesheet"/>
<style>
    .fed-part-rows{
        display: flex;
        flex-wrap: wrap;
    }
    .fed-col-xs3{
        width: 23%;
        padding: 1%;
    }
    .fed-btns-info{
        display: block;
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
        padding: 0.5rem 0;
        color: white;
        line-height: 1.125rem;
        text-align: center;
        cursor: pointer;
    }
    .fed-back-green{
        background-color: #ff5f00!important;
    }
    .fed-back-default{
        background-color: grey!important;
    }
</style>
{/block}
{block name="content"}

{include file="./template/default/m/pub/top2.html" /}
<div class="detail-main" style="margin-top: 2rem;">
    <img class="detail-main-bg" data-original="{$book.cover_url|get_img_url|default=''}" src="https://ae01.alicdn.com/kf/He3cda13f34d44e8fb85dcdf6c7768398F.gif">
    <div class="detail-main-cover">
        <img class="lazy" data-original="{$book.cover_url|get_img_url|default=''}" src="https://ae01.alicdn.com/kf/He3cda13f34d44e8fb85dcdf6c7768398F.gif">
    </div>
    <div class="detail-main-info">
        <p class="detail-main-info-title">{$book.book_name}</p>
        <p class="detail-main-info-author">别名：
            <a href="#">{$book.nick_name}</a>
        </p>
        <p class="detail-main-info-author">作者：
            <a href="#">{$book.author.author_name}...</a>
        </p>
        <p class="detail-main-info-author">地区：
            <a href="/{$booklist_act}/?area={$book.area_id}">{$book.area.area_name}</a>
        </p>
        <p class="detail-main-info-class">
            {volist name="tags" id="vo"}
            <span>
                <a href="/{$booklist_act}/?tag={$vo}">{$vo}</a>
            </span>
            {/volist}
        </p>
    </div>
</div>
<p class="detail-desc">{$book.summary}</p>
<div class="manga-list" style="margin-top: -1.5rem;">
    <label class="manga-list-title index" style="display: block">在线观看</label>
    <ul class="fed-part-rows">
        <?php $book_name=remove_tag($book->book_name); ?>
        <li class="fed-col-xs3"><a
                class="fed-btns-info fed-back-default" lineid="1" href="#" >当前线路</a>
        </li>
        {raccoon:books name="books" where="book_name like '$book_name%'"
        order="hits desc" limit="6"}
            <?php $current_book_name= remove_tag($vo->book_name); ?>

            {if $current_book_name==$book_name && $vo.book_name != $book.book_name}
            <li class="fed-col-xs3"><a
                    class="fed-btns-info fed-back-green" lineid="1" href="/{$book_ctrl}/{$vo.param}" title="{$vo.book_name}">{$vo.book_name|get_tag}</a>
            </li>
            {/if}
        {/raccoon:books}
    </ul>
</div>
<div id="tempc">
    <div class="detail-selector item-3">
        <a class="detail-selector-item active" href="javascript:void(0);"
           onclick="titleSelect(this, '#chapter_indexes');">目录</a>
        <a class="detail-selector-item" href="javascript:void(0);"
           onclick="titleSelect(this, '#recommand');">推荐漫画</a>
        <a class="detail-selector-item" href="javascript:void(0);"
           onclick="titleSelect(this, '#comment');">评论
            <span class="detail-selector-item-count commentcount">999+</span>
        </a>

    </div>
    <div id="chapter_indexes" class="selector-zero">
        <div class="detail-list-title" id="detail-list-title">
            <span class="detail-list-title-1">{$book.end==0?'连载中':'已完结'}</span>
            <span class="detail-list-title-3">{$book.last_time|date='Y-m-d'}更新</span>
            <a href="javascript:void(0);" mode="0" onclick="sortBtnClick(this);" class="detail-list-title-right inverted">倒序</a>
        </div>
        {if $book.is_copyright == 0}
        <ul class="detail-list-1 detail-list-select" id="detail-list-select">
            {raccoon:chapters name="chapters" where="book_id='$book->id'" order="chapter_order asc"}
            <li>
                <a href="/{$chapter_ctrl}/{$vo.id}" title="{$vo.chapter_name}" class="chapteritem">{$vo.chapter_name}</a>
                {if $vo.chapter_order >= $start_pay }
                <img class="detail-list-3-info-right" src="/static/images/center-main-list-logo-4.png">
                {/if}
            </li>
            {/raccoon:chapters}
        </ul>
        {/if}
        <div class="detail-fix-bottom">
            {if $xwx_user_id == null}
            <a href="javascript:void(0);" class="collection">
                <img class="detail-bottom-1" src="/static/images/detail-bottom-1.png">
            </a>
            {else /}
            {if $isfavor == 0}
            <a href="javascript:void(0);" class="collection" data-val="0" id="addfavor">
                <img class="detail-bottom-1" src="/static/images/detail-bottom-1.png">
            </a>
            {else /}
            <a href="javascript:void(0);" class="collection" data-val="1" id="addfavor">
                <img class="detail-bottom-1" src="/static/images/book-list-bottom-right-2.png">
            </a>
            {/if}
            {/if}
            <a href="javascript:void(0)" class="btndownload">
                <img class="detail-bottom-2" src="/static/images/detail-bottom-2.png">
            </a>
            {if $book.is_copyright == 1}
                <a href="{$book.src_url}" class="detail-bottom-btn">正版阅读</a>
            {else /}
                {if $start == -1}
                <a href="#" class="detail-bottom-btn">暂无章节</a>
                {else /}
                <a href="/{$chapter_ctrl}/{$start}" class="detail-bottom-btn">开始阅读</a>
                {/if}
            {/if}
        </div>
        <a class="detail-list-more" id="detail-list-more" href="javascript:void(0);" onclick="charpterMore(this);">展开全部章节</a>
        <script>
            $(document).ready(function(){
                var much = $("#detail-list-select li").length + 1;
                if (much <= 13) {
                    $('#detail-list-more').hide();
                }
            })

        </script>
    </div>

    <script>
        ;(function(){
            $("#detail-list-select li").each(function(){
                var tsi=$(this).index();
                $(this).attr("idx",tsi);
            })
        })();

        $('a.collection').click(function () {
            var val = $(this).attr('data-val');
            $.post({
                url:`/addfavor`,
                data:{'book_id' : {$book.id}, 'val' : val },
                success: function (res) {
                    if (res.err == 1){
                        ShowDialog(res.msg);
                    } else {
                        if (res.isfavor == 1){ //表示收藏了，将控件状态改为已收藏
                            $('#addfavor').attr('data-val',1);
                            $('img.detail-bottom-1').attr('src','/static/images/book-list-bottom-right-2.png')
                            ShowDialog('收藏成功');
                        } else { //更改为未收藏
                            $('#addfavor').attr('data-val',0);
                            $('img.detail-bottom-1').attr('src','/static/images/detail-bottom-1.png')
                            ShowDialog('取消收藏');
                        }
                    }
                },
            })
        })

    </script>

    <div class="win-comment" id="win-comment" style="display: none;">
        <a href="javascript:$('#win-comment').hide();" class="closecomment">
            <img class="win-comment-cross" src="/static/images/win-cross.png">
        </a>
        <p class="win-comment-title">发表评论</p>
        <textarea class="win-comment-input comment-input" id="content">

            </textarea>
        <a class="win-comment-btn" onclick="subcomment();">发表评论</a>
    </div>
    <input type="hidden" id="book_id" value="{$book.id}">
    <input type="hidden" id="session_uid" value="{$xwx_user_id|default=-1}">
    <div id="comment" style="display:none;" class="selector-zero">
        <ul class="detail-list-comment" style="display: block;">
            {raccoon:comments name="comments" where="book_id='$book->id'" order="id desc"}
            <li>
                <div class="detail-list-comment-cover">
                    <img src="/static/images/mrtx.gif">
                </div>
                <div class="detail-list-comment-info">
                    <p class="detail-list-comment-title">{$vo.user.nick_name|default=$vo.user.username}
                        <a class="detail-list-comment-right zanbtn" href="javascript:void(0);">1</a>
                    </p>
                    <p class="detail-list-comment-subtitle">{$vo.create_time|date='Y-m-d'}</p>
                    <p class="detail-list-comment-content recommentbtn" >{$vo.content|raw}</p>
                </div>
            </li>
            {/raccoon:comments}
        </ul>
        <div class="detail-comment-fix-bottom">
            <a class="detail-comment-fix-bottom-a btncomment" href="javascript:$('#win-comment').show();">
                <img class="detail-comment-fix-bottom-logo" src="/static/images/detail-comment-logo.png">我已经忍不住要吐槽啦～
            </a>
        </div>
    </div>
    <div id="recommand" style="display:none;" class="selector-zero">
        {raccoon:books name="books" where="tags like '%book->tags%' or area_id='$book->area_id'"
        order="last_time desc" limit="6"}
        <div class="buy-manga">
            <div class="buy-manga-cover">
                <a href="/{$book_ctrl}/{$vo.param}">
                    <img src="{$vo.cover_url}">
                </a>
                <a class="buy-manga-cover-hover" href="javascript:void(0);" mid="2941" style="display:none;"></a>
            </div>
            <div class="buy-manga-info">
                <a href="/{$book_ctrl}/{$vo.param}" class="readlink" mid="2941">
                    <p class="buy-manga-title">{$vo.book_name}</p>
                </a>
                <p class="buy-manga-author">{$vo.last_time|date='Y-m-d'}更新</p>
                <a href="/{$book_ctrl}/{$vo.param}" class="readlink" mid="40683">
                    <p class="buy-manga-new">{$vo.summary|subtext=12}...</p>
                </a>
                <a class="buy-manga-right-a readlink" href="/{$book_ctrl}/{$vo.param} ">
                    <img class="buy-manga-right-img" src="/static/images/buy-manga-right.png">
                    <p class="buy-manga-right-title">阅读</p>
                </a>
            </div>
        </div>
        {/raccoon:books}
    </div>
</div>
<div class="toast" style="display:none;"></div>
<div class="manga-list">
    <div class="manga-list-title index">最热漫画
        <a class="manga-list-title-more" href="/{$booklist_act}">更多</a>
    </div>
    <ul class="manga-list-2">
        <div class="swiper-container2 swiper-container-horizontal swiper-container-free-mode swiper-container-ios swiper-container-wp8-horizontal">
            <div class="swiper-wrapper" style="transform: translate3d(0px, 0px, 0px);">
                <div class="swiper-slide swiper-slide-active">

                    {raccoon:books name="books" where="area_id='$book->area_id'" order="hits desc" limit="1,3"}
                    <li>
                        <div class="manga-list-2-cover">
                            <a href="/{$book_ctrl}/{$vo.param}" title="{$vo.book_name}">
                                <img class="manga-list-2-cover-img lazy"
                                     data-original="{$vo.cover_url}"
                                     src="https://p.pstatp.com/origin/ffa400036691f82c85e5">
                            </a>
                        </div>
                        <p class="manga-list-2-title">
                            <a href="/{$book_ctrl}/{$vo.param}" title="{$vo.book_name}">{$vo.book_name}</a></p>
                        <p class="manga-list-2-tip">
                            <a href="/{$book_ctrl}/{$vo.param}">{$vo.hits}次点击</a>
                        </p>
                    </li>
                    {/raccoon:books}
                </div>
                <div class="swiper-slide swiper-slide-next">
                    {raccoon:books name="books" where="area_id='$book->area_id'" order="hits desc" limit="4,3"}
                    <li>
                        <div class="manga-list-2-cover">
                            <a href="/{$book_ctrl}/{$vo.param}" title="{$vo.book_name}">
                                <img class="manga-list-2-cover-img lazy"
                                     data-original="{$vo.cover_url}"
                                     src="https://p.pstatp.com/origin/ffa400036691f82c85e5">
                            </a>
                        </div>
                        <p class="manga-list-2-title">
                            <a href="/{$book_ctrl}/{$vo.param}" title="{$vo.book_name}">{$vo.book_name}</a></p>
                        <p class="manga-list-2-tip">
                            <a href="/{$book_ctrl}/{$vo.param}">{$vo.hits}次点击</a>
                        </p>
                    </li>
                    {/raccoon:books}
                </div>
                <div class="swiper-slide">
                    {raccoon:books name="books" where="area_id='$book->area_id'" order="hits desc" limit="7,3"}
                    <li>
                        <div class="manga-list-2-cover">
                            <a href="/{$book_ctrl}/{$vo.param}" title="{$vo.book_name}">
                                <img class="manga-list-2-cover-img lazy"
                                     data-original="{$vo.cover_url}"
                                     src="https://p.pstatp.com/origin/ffa400036691f82c85e5">
                            </a>
                        </div>
                        <p class="manga-list-2-title">
                            <a href="/{$book_ctrl}/{$vo.param}" title="{$vo.book_name}">{$vo.book_name}</a></p>
                        <p class="manga-list-2-tip">
                            <a href="/{$book_ctrl}/{$vo.param}">{$vo.hits}次点击</a>
                        </p>
                    </li>
                    {/raccoon:books}
                </div>
            </div>
        </div>
    </ul>
</div>
<div style="height:70px;"></div>

<script>
    function titleSelect(item,id) {
        $('.detail-selector-item').removeClass('active');
        $(item).addClass('active');
        $('.selector-zero').hide();
        $(id).show();
    }
</script>
<script>
    function subcomment() {
        var uid = $('#session_uid').val();
        var comment = $('#content').val();
        var book_id = $('#book_id').val();
        if (uid === '-1') {
            ShowDialog('请先登录');
        } else if (comment.length <= 0) {
            ShowDialog('请勿提交空评论');
        } else {
            $.post({
                url: '/commentadd',
                data: {comment: comment, book_id: book_id},
                success(res) {
                    if (res.err === 1) {
                        ShowDialog(res.msg);
                    } else {
                        ShowDialog(res.msg);
                        setTimeout(function () {
                            location.reload();
                        },1000)
                    }
                },
                error(res) {
                    ShowDialog('表单提交出错');
                    return false;
                }
            })
        }
    }
</script>
{include file="./template/default/m/pub/return_top.html"}
<script src="https://lib.baomitu.com/Swiper/4.5.0/js/swiper.min.js"></script>
<script type="text/javascript">
    var mySwiper = new Swiper('.swiper-container', {
        loop: true,
        autoplay: {disableOnInteraction: false,},
        pagination: {el: '.swiper-pagination',},
    });
    var mySwiper2 = new Swiper('.swiper-container2', {freeMode: true, slidesPerView: 'auto',});
    var mySwiper_rank = new Swiper('#rank_list', {
        freeMode: true,
        slidesPerView: 'auto',
        on: {
            slideChangeTransitionEnd: function () {
                $('.manga-list-title-right-item').removeClass('active');
                $('.manga-list-title-right-item').eq(this.activeIndex).addClass('active');
            },
        }
    });
</script>
{/block}